
# 连接数据库


# 1. 导包
import pymysql

# 2. 建立数据库连接
conn = pymysql.connect(host="localhost",user="root",password="root",database="school",charset='utf8')

# 3. 创建游标
cursor = conn.cursor()

# 4. 执行sql语句
# sql = "insert into students values('55','hello',32,'男','2班','67237230232362323892','上海')"

# sql = "update students set age = 71,city='北京' where studentNo = 55"

sql = "delete from students where studentNo = 55"
cursor.execute(sql)


# 5. 关闭游标
cursor.close()

# 6. 关闭连接
conn.close()